Plotly examples from Saurav Kaushik (https://www.analyticsvidhya.com/blog/2017/01/beginners-guide-to-create-beautiful-interactive-data-visualizations-using-plotly-in-r-and-python/)
library(plotly)
hist <- plot_ly(x=Sepal.Length, type='histogram')
# defining labels and title using layout()
layout(hist, title = "Iris Dataset - Sepal.Length",
xaxis = list(title = "Sepal.Length"),
yaxis = list(title = "Count"))
Figure 1
box_plot <- plot_ly(y=Sepal.Length, type='box', color=Species)
layout(box_plot, title = "Iris Dataset - Sepal.Length Boxplot",
yaxis = list(title="Sepal.Length"))
Figure 2
scatter_plot <- plot_ly(x = Sepal.Length, y=Sepal.Width, type='scatter', mode='markers', color=Species)
layout(scatter_plot, title = "Iris Dataset - Sepal.Length vs Sepal.Width",
xaxis = list(title = "Sepal.Length"),
yaxis = list(title = "Sepal.Width"))
Figure 3
data("AirPassengers")
time_series <- plot_ly(x=time(AirPassengers), y=AirPassengers, type="scatter", mode="lines")
layout(time_series, title = "Iris Dataset - AirPassengers Dataset - Time Series Plot",
xaxis = list(title = "Time"),
yaxis = list(title = "Passengers"))
Figure 4
data("volcano")
plot_ly(z=~volcano, type="heatmap")
Figure 5